<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<style>
<!--
.notification_box  li {
	height: 30px; padding: 0px; background: #f8f8f8; float: left; width: 90px; margin-left: 10px; position: relative; border: 1px solid #ccc;
}

.notification_box .firstli {
	position: absolute; min-width: 50px; left: 3px; line-height: 31px; text-align: center;
}

.notification_box .secli {
	color: #fff; position: absolute; right: 0; width: 30px; background: #48ac2e; height: 30px; text-align: center; line-height: 31px; position: absolute;
}

html {
	overflow: auto
}
-->
</style>



<isperp:grid url="kpi/change/dataList?fromType=${fromType}&key=${key }&value=${value }&1=1${url }" actionsWidth="50"
	rowNum="10" gridId="changeGrid" sortname="create_date"
	sortorder="desc" autowidth="true"
	ondbClickRowEvent="changeGrid.view(rowid);" autoReloadGrid="false"
	autoReloadTreeMenu="changeMenu" cusViewUrl="change/change/view"
	advanceSearch="true"
	keywordFields="code,title"
	keywordTitle="输入编号/标题">

	<jsp:attribute name="toolbar">
	<isperp:treeMenu id="changeMenu" targetGridId="changeGrid">
		<isperp:callback onClick="changeMenuTree_onNodeClick"
				onAsyncSuccess="changeMenuTree_onNodeClickFirst();">
		</isperp:callback>
	</isperp:treeMenu>
	<isperp:toolbar id="userToolbar">
	 
	</isperp:toolbar>
	</jsp:attribute>

	<jsp:attribute name="searchbar">
	 
	<table class="search-table">
		<tbody>
		<tr>
			<td class="td1">编号：</td>
			<td class="td2"><input type="text" field="code" op="cn">
			</td>
			<td class="td1">标题：</td>
			<td class="td2"><input type="text" field="name" op="cn">
			</td>
			
			<td class="td1">分类：</td>
				<td class="td2"><input type="hidden" id="chgCategoryId"
						field="chg_category_id" op="cn" /> <isperp:treeSelector
							url="incident/category/getTree" id="chgCategorySelector"
							name="chgCategoryName" displayValue=""
							valueControlId="chgCategoryId"></isperp:treeSelector>
					</td>
			
			
			
		</tr>
		  
		<tr>
		    <td class="td1">类型：</td>
			<td class="td2">
			<isperp:dictSelector id="change_type" field="change_type" op="in"
							hasEmptyValue="true" multiple="true"
							typeCode="CHANGE_TYPE"></isperp:dictSelector>
			</td>
		     <td class="td1">所属项目：</td>
			<td class="td2"><form:select path="projects" field="project_id"
							op="cn" data-allow-empty="true" items="${projects}"
							itemLabel="name" itemValue="id" cssClass="search" />
			</td>
			<td class="td1">请求人：</td>
			<td class="td2"><input type="text" field="creator,creator_name"
						op="cn">
			</td>
			
		</tr>
		
		
		<tr>
		    <td class="td1">请求日期：</td>
			<td class="td2"><input id="requestDateStart" type="date"
						field="request_date" op="gt" style="width: 68px" />~<input
						id="requestDateEnd" type="date" field="request_date" op="lt"
						style="width: 68px" />
			</td>
			<td class="td1">实施日期：</td>
			<td class="td2"><input id="executeTimeStart" type="date"
						field="execute_time" op="gt" style="width: 68px" />~<input
						id="executeTimeEnd" type="date" field="execute_time" op="lt"
						style="width: 68px" />
			</td>
			<td class="td1">实施者：</td>
			<td class="td2">
				<input type="text" field="executer_name"
						op="cn">
			</td>
			
		</tr>
		
		<tr>
			<td class="td1">优先级：</td>
			<td class="td2">
			<isperp:dictSelector id="priority" field="priority" op="in"
							hasEmptyValue="true" multiple="true" typeCode="INCIDENT_PRIORITY"></isperp:dictSelector>
			</td>
		
			<td class="td1">变更状态：</td>
			<td class="td2" colspan="3">
			  <isperp:dictSelector id="change_status" field="status" op="in"
							hasEmptyValue="true" multiple="true"
							typeCode="CHANGE_STATUS"></isperp:dictSelector>
			</td>
		</tr>
		
	</tbody>
	</table>
	</table>
	</jsp:attribute>
	<jsp:body>
	<isperp:column name="id" title="id" hidden="true">
	</isperp:column>
	<isperp:column name="priority_name" title="" width="28"
			isFormatterFun="true"
			formatter="return statusFormatter(rowObject);">
	</isperp:column>
	<isperp:column name="code" title="编号" width="70">
	</isperp:column>
	<isperp:column name="title" title="标题" width="100">
	</isperp:column>
	<isperp:column name="requester_name" title="请求人" width="70">
	</isperp:column>
	<isperp:column name="request_date" title="请求日期" width="90">
	</isperp:column>
	<isperp:column name="change_type" title="类型" width="80">	
	</isperp:column>
	<isperp:column name="chg_category_name" title="分类" width="70">	
	</isperp:column>
	<isperp:column name="executer_name" title="实施者" width="80">
	</isperp:column>
	<isperp:column name="execute_time" title="实施日期" width="80">
	</isperp:column>
	<isperp:column name="status" title="状态" width="60">
	</isperp:column>
	</jsp:body>
</isperp:grid>

<script type="text/javascript">
	 
	
	function statusFormatter(rowObject) {
		var p = 0, html = "", title = "";
		if (rowObject.priority_name != null) {

			switch (rowObject.priority_name) {
			case "一级":
				p = 1;
				break;
			case "二级":
				p = 2;
				break;
			case "三级":
				p = 3;
				break;
			case "四级":
				p = 4;
				break;
			case "五级":
				p = 5;
				break;
			}
			title = "优先级：" + p + "级";
		} else {
			title = "未确定优先级";
		}

		html = "<img title='"+title+"' src='img/incident/p"+p+".png'>";
		if (rowObject.sla_status == 1) {

			html = html + "&nbsp;<img title='SLA：异常'  src='img/incident/sla_unusual.png'>";
		}
		return html + "&nbsp;<a id='msg_" + rowObject.id + "' href=\"javascript:openRelationMessage('" + rowObject.id + "')\" class=''></a>";
	}

	function openRelationMessage(id) {

		isperp.openDialog({
			title : "查看消息",
			contentUrl : "app/message/relationMessageView?all=1&sourceId=" + id
		});
	}
	 
	 
</script>


<isperp:buttonList>
</isperp:buttonList>